%*********************************************************/
% (C) COPYRIGHT 2010 
% ALL RIGHT RESERVED.
%-----------------------------
% $Header: $
% $Author: dongw $
% $Date: $
% $Revision $
%------------------------------
% CODE TYPE: M Function
% DESCRIPTION:This function is used to draw quiver field 
% USAGE:
% draw_motion_field(motion_field, grid_size)
%   motion_field	should be a X*Y*2 matrix, [:,:,1] is MVx, [:,:,2] is MVy;
%   grid_size		should be a 2 element array, [gx, gy];
%-----------------------------------
% MODIFICATION HISTORY:
% CVS Revision History
% $Log: draw_motion_field.m,v $
%
%-----------------------------------

function draw_motion_field(motion_field, grid_size)
% this function is used to draw motion field

[numx, numy, numz ] =   size(motion_field);

gx  =   grid_size(1);                gy  =   grid_size(2);
ctx =   ceil(gx/2);             cty =   ceil(gy/2);
x   =   [ ctx :gx:gx*numx ]' * ones(1, numy);    y   =   ones(numx, 1) * [ cty :gy:gy*numy ];

quiver(x, y, motion_field(:,:,1), motion_field(:,:,2));
